package com.itgt.train;

public class CashCow {
	private int height=0;
	private int goldPiece=0;
	private boolean wormy=false;
	private int pesticide=0;
	public void grow(){
	    height+=2;
	    goldPiece+=10;
	}
	public void buy(){
	    if(goldPiece>0){
	    	goldPiece-=1;
	    	pesticide+=100;
	    }
	}
	public void kill(){
	    if(wormy=true){
	    	if(pesticide>0) {
		    	pesticide-=50;
		    	goldPiece+=5;
		    	wormy=false;
	    	}
	    }
	}
	public void watering(){
		goldPiece+=5;
		height+=1;
		wormy=false;
	}
	public void show(){
	    System.out.println("摇钱树的高度："+height);
	    System.out.println("摇钱树的金币："+goldPiece);
	    System.out.print("摇钱树是否有虫子：");
	    if(wormy=true) {
	    	System.out.println("摇钱树有虫子");
	    }else {
	    	System.out.println("摇钱树没虫子");
	    }
	    System.out.println("杀虫剂数量："+pesticide);
	}
}
